/**
 * Represents a device that can perform calculations
 * 
 * @author () 
 * @version (10/19/09)
 */
public class Device  
{
    private int calculations_per_tick;
	private Process running_process;

    /**
     * Constructor for objects of class Device
     */
    public Device(int speed) {
		calculations_per_tick = speed; // better name?
		running_process = null;
    }

    public Process emptyDevice() {
		Process ran_process = running_process;
		running_process = null;
        return ran_process;
    }
	
	public boolean insert(Process p) {
		if (running_process != null) { return false; }
		running_process = p;
		return true;
	}
	
	// executes the process that is currently in Device
	// -1 = no process was in Device
	// 0 = process did not finish at end
	// 1 = process reached IO interrupt.
	// 2 = process completed
	public int execute() {
		if (running_process == null) { return -1; }
		// execution code;
		return 0;
	}
}
